package com.aspose.cells.a.d;

import com.aspose.cells.Color;
import java.util.ArrayList;

public class zgh {
   private boolean a;
   private zge b;
   private com.aspose.cells.zal c;
   private boolean d;

   public zgh(zge var1, com.aspose.cells.zal var2, boolean var3) {
      this.b = var1;
      this.c = var2;
      this.d = var3;
   }

   public void a(int var1, float var2, float var3) throws Exception {
      if (this.d) {
         this.c.a("FixedPage");
      } else {
         this.c.b("FixedPage");
      }

      if (this.d) {
         this.c.c("xmlns", "http://schemas.microsoft.com/xps/2005/06");
         this.c.c("xmlns:x", "http://schemas.microsoft.com/xps/2005/06/resourcedictionary-key");
      }

      this.c.c("xml:lang", "en-us");
      this.c.c("Width", zgf.b((double)var2));
      this.c.c("Height", zgf.b((double)var3));
      this.c.c("Name", com.aspose.cells.b.a.zv.a("Page{0}", var1));
      if (zcq.a(this.b.d().a()) && this.d) {
         this.c.a().c(com.aspose.cells.b.a.zv.a("Generated by {0}", this.b.d().a()));
      }

      this.c.b("Canvas");
      com.aspose.cells.b.a.b.a.zi var4 = new com.aspose.cells.b.a.b.a.zi();
      var4.a(1.3333334F, 1.3333334F, 0);
      this.c.c("RenderTransform", zgf.a(var4));
   }

   public void a() throws Exception {
      this.c.c();
      if (this.d) {
         this.c.b();
      } else {
         this.c.c();
      }

   }

   public void a(zb var1) throws Exception {
      this.c.b("Canvas");
      if (var1.d() != null) {
         this.c.c("FixedPage.NavigateUri", this.a(var1.d()));
      }

      if (var1.a() != null) {
         this.c.c("RenderTransform", zgf.a(var1.a()));
      }

      if (zaz.d(var1)) {
         if (var1.b() != null && var1.b().g().size() > 0) {
            ArrayList var2 = var1.b().g();
            zo var3 = (zo)((zo)var2.get(0));
            if ((double)Math.abs(var3.a().d()) > 1.0E7D || (double)Math.abs(var3.a().e()) > 1.0E7D) {
               return;
            }
         }

         zgl var4 = new zgl(true);
         this.c.c("Clip", var4.a(var1.b(), true));
      }

   }

   public void b() throws Exception {
      this.c.c();
   }

   public void a(zn var1) throws Exception {
      this.a = zgm.a(this.c, this.b, var1);
   }

   public void c() throws Exception {
      if (this.a) {
         zgm.a(this.c);
      }

   }

   public void a(zj var1) throws Exception {
      this.c.b("Path");
      if (var1.g() != null) {
         this.c.c("FixedPage.NavigateUri", this.a(var1.g()));
      }

      zn var2 = zn.b(new com.aspose.cells.b.a.b.zq(var1.b(), var1.c()));
      zgl var3 = new zgl();
      this.c.c("Data", var3.a(var2, false));
      this.c.b("Path.Fill");
      zgc.a(this.c, this.b, var1.d(), var1.h(), 4, (com.aspose.cells.b.a.b.a.zi)null);
      this.c.c();
      this.c.c();
   }

   public void a(zf var1) throws Exception {
      String var2 = this.c.d(var1.h());
      zfq var3 = zfs.b(var1.d().a(), var1.d().c(), false);
      var2 = this.b.a(var3, var2);
      if (zcq.a(var2)) {
         var2 = var2.startsWith("{") ? "{}" + var2 : var2;
         this.c.b("Glyphs");
         this.c.c("OriginX", com.aspose.cells.a.c.zp.b(var1.g().d()));
         this.c.c("OriginY", com.aspose.cells.a.c.zp.b(var1.g().e()));
         this.c.c("UnicodeString", var2);
         Color var4 = var1.e().isEmpty() ? (var1.f().isEmpty() ? Color.getBlack() : var1.f()) : var1.e();
         this.c.c("Fill", zgf.a(var4));
         this.c.c("FontRenderingEmSize", com.aspose.cells.a.c.zp.b(var1.d().b()));
         var3 = zfs.b(var1.d().a(), var1.d().c(), false);
         String var5 = this.b.a(var3);
         this.c.c("FontUri", var5);
         String var6 = a(var1.d());
         if (zcq.a(var6)) {
            this.c.c("StyleSimulations", var6);
         }

         if (var1.a() != null) {
            this.c.c("RenderTransform", zgf.a(var1.a()));
         }

         if (var1.b() != null) {
            zgl var7 = new zgl();
            this.c.c("Clip", var7.a(var1.b(), true));
         }

         if (var1.m() != null) {
            this.c.c("FixedPage.NavigateUri", this.a(var1.m()));
         }

         this.c.c();
      }

   }

   private static String a(zav var0) {
      String var1 = "";
      if (var0.k().k() != var0.c()) {
         if (var0.d() && var0.e()) {
            var1 = "BoldItalicSimulation";
         } else if (var0.d()) {
            var1 = "BoldSimulation";
         } else if (var0.e()) {
            var1 = "ItalicSimulation";
         }
      }

      return var1;
   }

   private String a(zi var1) {
      return var1.b() ? com.aspose.cells.b.a.zv.a(this.d ? "../FixedDocument.fdoc#{0}" : "#{0}", this.b.a(var1.c())) : var1.c();
   }
}
